package com.ruoyi.project.wenyanwen.generate.convert;

import com.ruoyi.project.wenyanwen.generate.domain.mysql.MysqlZi;
import com.ruoyi.project.wenyanwen.generate.domain.sqlite.ZiSqlite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jackyshi
 */
public class ZiConvert extends AbstractConvert {

    @Override
    public List<ZiSqlite> convert(List<?> list) {

        List<ZiSqlite> l = new ArrayList<>();

        for (Object obj : list) {

            MysqlZi zi = (MysqlZi) obj;
            ZiSqlite model = new ZiSqlite();
            model.set_id(zi.getId().intValue());
            model.setZi(zi.getZiString());
            model.setJtz(zi.getJtz());
            model.setFzi(zi.getFzi());
            model.setPy(zi.getPy());
            model.setPinyin(zi.getPinyin());
            model.setBushou(zi.getBushou());
            model.setJiegou(zi.getJiegou().intValue());
            model.setZongbihua(zi.getZongbihua().intValue());
            model.setBuwaibihua(zi.getBuwaibihua().intValue());
            model.setWys(zipAndencrypt(zi.getWys()));
            model.setCangjie(zi.getCangjie());
            model.setGycd(zipAndencrypt(zi.getGycd()));
            l.add(model);
        }

        return l;
    }
}
